-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy returned bytes from TSI meta functions. #8975
Copy returned bytes from TSI meta functions. #8975
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Does this not need to be added anywhere else though? It's not clear to me when we need to copy slices and when we don't. Maybe some comments/doc could leave future hints 😄
tsdb/index/tsi1/tsi1.go
Outdated
@@ -802,6 +802,15 @@ func copyBytes(b []byte) []byte { | |||
return buf | |||
} | |||
|
|||
// copyBytes returns a copy of a slice of byte slices. | |||
func copyByteSlices(a [][]byte) [][]byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any qualms about this being here, but it could also live happily alongside Union(a, b [][]byte) [][]byte
and Intersect(a, b [][]byte) [][]byte
in the bytesutil
package. Maybe as Clone(a [][]byte) [][]byte
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I moved these up to bytesutil
in d17d0f1.
@benbjohnson ⭐️ ⭐️ ⭐️ ⭐️ ⭐️ ⭐️ DoUbLe ApProVE ⭐️ ⭐️ ⭐️ ⭐️ ⭐️ |
Required for all non-trivial PRs